package com.chuck.learning.solutions;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

public class 栅栏测试 {

    static CyclicBarrier cyclicBarrier= new CyclicBarrier(2);

    public static void main(String[] args) {
        Runnable runnable=()->{
            try {
                cyclicBarrier.await();
                System.out.println("执行啦");
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (BrokenBarrierException e) {
                e.printStackTrace();
            }
        };

        new Thread(runnable).start();
//        new Thread(runnable).start();
    }
}
